package com.zcp.eventbusdemo;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;

import org.greenrobot.eventbus.EventBus;

public class Main2Activity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);
        Button btn = (Button) findViewById(R.id.button);

        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                DataSynEvent dataSynEvent = new DataSynEvent(100);
                EventBus.getDefault().post(dataSynEvent);
                onBackPressed();
            }
        });
    }

    //事件销毁
    @Override
    protected void onDestroy() {
        super.onDestroy();
        //啦啦啦
    }
}
